#pragma once
#include <QTabWidget>
#include <QItemSelection>
#include "tableModel.h"
#include "newAddressTab.h"

class AddressWidget : public QTabWidget
{
    Q_OBJECT
public:
    AddressWidget(QWidget* parent = nullptr);
    ~AddressWidget();

    void readFromFile(const QString& strFile);
    void writeToFile(const QString& strFile);

public slots:
    void showAddEntryDialog();
    void addEntry(const QString& name, const QString& address);
    void editEntry();
    void removeEntry();

signals:
    void selectionChanged(const QItemSelection& selected);

private:
    void setupTabs();

    TableModel* m_pTableModel = nullptr;
    NewAddressTab* m_pNewAddressTab = nullptr;
};
